package com.group9.handinhand.dao.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.group9.handinhand.service.so.GoodsSO;

@Entity
@Table(name = "GOODS")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Goods extends AbstractBaseModel {

	private static final long serialVersionUID = 1L;
	
	@Column(name = "UNIT")
	private String unit;
	
	@Column(name = "ITEM_NAME", nullable = false)
	private String itemName;
	
	@Column(name = "TARGET_AMOUNT")
	private int targetAmount;
	
	@Column(name = "RESPONDED_AMOUNT", nullable = false)
	private int respondedAmount;
	
	public GoodsSO convertToServiceObject() {
		GoodsSO so = (GoodsSO) convert(new GoodsSO());
		return so;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	public int getTargetAmount() {
		return targetAmount;
	}

	public void setTargetAmount(int targetAmount) {
		this.targetAmount = targetAmount;
	}

	public int getRespondedAmount() {
		return respondedAmount;
	}

	public void setRespondedAmount(int respondedAmount) {
		this.respondedAmount = respondedAmount;
	}

	@Override
	public String toString() {
		return "Goods [unit=" + unit + ", itemName=" + itemName
				+ ", targetAmount=" + targetAmount + ", respondedAmount="
				+ respondedAmount + "]";
	}

}
